home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_a
/
c2tosd.lis
< prev
next >
Wrap
File List
|
1995-04-22
|
5KB
|
168 lines
1000 Rem DIMENSION AND INITIALIZE VARIABLES
1010 Dim Dirbuf$(8*128):Let Dirbuf$(8*128)="*"
1020 Dim First(1),Last(1)
1030 Dim Q$(1)
1040 Dim Secbuf$(300)
1050 Dim Copytodir$(100),Copyto$(120)
1060 Rem
1070 Rem MESSAGES AND ANSWERS
1080 Rem
1090 Put #0,125
1100 Print "Copy files from DOS 2.x disk to"
1110 Print " virtually any other DOS"
1120 Print " (including SpartaDOS)"
1130 ? :?
1140 Print "First, where are the DOS 2.x files...":?
1150 Trap 1150
1160 Input "What drive number? ",Drvnum
1170 Trap 0
1180 ? :? :?
1190 Print "Then, where should we copy them to..."
1200 Print " Give drive AND directory name as"
1210 Print " needed (e.g., D2: or D3:>MYDIR>)."
1220 Print
1230 Print " [Trailing ':' or '>' IS needed!]"
1240 ? :Input "Where to? ",Copytodir$
1250 If Len(Copytodir$)<3 Then Oops=1:Goto 1300
1260 Q$=Copytodir$(Len(Copytodir$))
1270 Oops=0
1280 If Q$<>":" And Q$<>">" And Q$<>"\" Then Oops=1
1290 If Copytodir$(1,1)<>"D" Or Copytodir$(3,3)<>":" Then Oops=1
1300 Trap 0
1310 If Oops:? :?
1320 Print "Sorry, something is wrong with the "
1330 Print " name of your 'Where to' directory."
1340 End
1350 Endif
1360 Rem .........
1370 If Val(Copytodir$(2))=Drvnum:Rem OOPS!
1380 ? :? :Print "Sorry, this program is not set up for"
1390 Print " single drive transfers!"
1400 End
1410 Endif
1420 Rem
1430 Rem READ THE DIRECTORY OF DOS 2.X DISK
1440 Rem
1450 For Sector=0 To 7
1460 Secnum=$0169+Sector
1470 Secbuf=Adr(Dirbuf$)+128*Sector
1480 Gosub 2480
1490 Next Sector
1500 Rem FIND LAST FILE IN DIRECTORY
1510 Rem
1520 Maxf=63
1530 For Fnum=0 To 63
1540 Flag=Peek(Adr(Dirbuf$)+Fnum*16)
1550 If Flag=0 Then Maxf=Fnum-1:Fnum=99
1560 Next Fnum
1570 If Maxf<0 Then Print "NO FILES ON THIS DISK!":End
1580 Rem
1590 Rem SET UP LIMITS FOR DISPLAY
1600 First(0)=0:Last(0)=39
1610 First(1)=-1
1620 If Maxf>Last(0):Last(0)=31
1630 First(1)=32:Last(1)=Maxf
1640 Else :Last(0)=Maxf
1650 Endif
1660 Rem
1670 Rem ............................
1680 Rem
1690 Rem (MAIN LOOP)
1700 Rem
1710 Half=1:Rem CURRENT SET OF FILES
1720 Rem (NEXT LINE IS ENTRY FOR OTHER HALF OF FILES)
1730 Rem
1740 Rem ASK WHICH FILE #
1750 Rem
1760 Half=1-Half
1770 First=First(Half):Last=Last(Half)
1780 If First<0 Then 1730
1790 Gosub 2360
1800 Print :Print
1810 Trap 1730
1820 Input "Number (RETURN for more files)? ",Fnum
1830 Trap 0
1840 Rem
1850 Rem USER GAVE US A FILE NUMBER...CHECK IT OUT
1860 Rem
1870 If Fnum<0 Or Fnum>Maxf Or Fnum<>Int(Fnum) Then 1710
1880 Gosub 2170:Rem GET NAME$?
1890 If Flag=0 Then Goto 1710:Rem OOPS...INVALID FILE NUMBER!
1900 Rem VALID FILE
1910 Put #0,125
1920 Copyto$=Copytodir$,Name$
1930 Print "Ready to copy:":?
1940 Print "[FROM] D";Chr$(48+Drvnum);":";Name$
1950 Print "[ TO] ";Copyto$
1960 ? :Input "Answer Y or N: Okay? ",Q$
1970 If Q$<>"Y" And Q$<>"y" Then 1710
1980 Rem
1990 Rem DO THE ACTUAL COPYING
2000 Rem
2010 Close #3:Open #3,8,0,Copyto$
2020 Secnum=Dpeek(Adr(File$)+3)
2030 Rem COPY LOOP
2040 While Secnum
2050 Print "Sector ";Secnum:Put #0,28
2060 Secbuf=Adr(Secbuf$)
2070 Gosub 2480:Rem GET THE SECTOR
2080 Check=Peek(Secbuf+125)&$fc
2090 If Check<>Fnum*4 Then ? "FILE LINK ERROR!":End
2100 If Peek(Secbuf+127) Then Bput #3,Secbuf,Peek(Secbuf+127)
2110 Secnum=256*(Peek(Secbuf+125)&3)+Peek(Secbuf+126)
2120 Endwhile
2130 Close #3
2140 ? :? :Input "COPY DONE...HIT RETURN",Q$
2150 Goto 1710
2160 End
2170 Rem
2180 Rem BUILD FILE NAME, CHECK ITS FLAGS
2190 Rem
2200 Rem ENTER: FNUM HAS FILE NUMBER
2210 Rem
2220 Rem EXIT: NAME$ HAS FILE IF VALID
2230 Rem . FLAG=0 IF NAME$ INVALID
2240 Rem . FILE$ HAS RAW FILE INFO
2250 Rem
2260 Name$=""
2270 File$=Dirbuf$(Fnum*16+1,Fnum*16+16)
2280 Flag=Asc(File$)
2290 If (Flag&$80)<>0 Then Flag=0
2300 If Flag:Rem (IF GOOD FILE)
2310 Name$=File$(6,16)," "
2320 Dot=Find(Name$," ",0):If Dot>8 Then Dot=9
2330 Name$(Dot)=".",File$(14,16)
2340 Endif
2350 Return
2360 Rem SHOW UP TO 32 FILES
2370 Rem
2380 Rem ENTRY: FIRST IS FIRST FILE TO DISPLAY
2390 Rem . LAST IS LAST ONE TO DISPLAY
2400 Rem
2410 Put #0,125
2420 For Fnum=First To Last
2430 Gosub 2170:Rem GET NAME$ SET UP
2440 If Flag Then Print Using "## !!!!!!!!!!!! ",Fnum,Name$,
2450 If Peek(85)>30 Then Print
2460 Next Fnum
2470 Return
2480 Rem
2490 Rem READ A SECTOR VIA SIO
2500 Rem
2510 Rem ENTER: SECNUM HAS SECTOR NUMBER
2520 Rem . SECBUF HAS BUFFER ADDRESS
2530 Rem . DRVNUM HAS DRIVE NUMBER
2540 Rem
2550 Poke $0300,$31
2560 Poke $0301,Drvnum
2570 Poke $0302,Asc("R")
2580 Poke $0303,$40
2590 Dpoke $0304,Secbuf
2600 Dpoke $0306,3
2610 Dpoke $0308,128
2620 Dpoke $030a,Secnum
2630 Set 8,0:Rem TELLS BXL _NOT_ TO PUSH COUNT OF PARAMETERS!
2640 Junk=Usr($e459):Rem CALL SIO
2650 If Peek($0303)>1 Then Print "SIO ERROR #";Peek($0303):End
2660 Return
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""